import axios from "axios";

let Request= {
    getData({url,data={},method="get"}){
        return new Promise((resolve,reject)=>{
           this.getReq(url,method,data,resolve,reject)
        })
    },
    getReq:function(url,method="get",data={},resolve,reject){
        let format = method == 'get'?'params':'data';
        axios({
            url:url,
            method:method,
            [format]:data,
        }).then(res=>{
            resolve(res)
        }).catch(()=>{
            reject()
        })
    }
}

export { Request }